package page;

/**
 * Created by IntelliJ IDEA.
 * User: Evgeniy Krasko
 * Date: 06.11.11
 * Time: 18:47
 */
public enum Lang {
    RU(1, "ru"),
    EN(2, "en");
    int index;

    Lang(int index, String domainPrefix) {
        this.index = index;
        this.domainPrefix = domainPrefix;
    }

    String domainPrefix;


    public int getIndex() {
        return index;
    }

    public String getDomainPrefix() {
        return domainPrefix;
    }

    public static Lang getLang(String domainPrefix) {
        for (Lang lang : Lang.values()) {
            if (lang.getDomainPrefix().equals(domainPrefix)) {
                return lang;
            }
        }
        return null;
    }

    public static Lang getLang(int index) {
        for (Lang lang : Lang.values()) {
            if (lang.getIndex() == index) {
                return lang;
            }
        }
        return null;
    }



}
